Micron Document
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| SparkN0de-git | SparkN0de |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Commit a812f0a5892b60a2fcf075eec8d1cdc38daa07fd


Parents : ebc4462
Author : Mark Qvist <mark@unsigned.io>
Date : 2025-01-26T12:53:40+01:00

Added lxmd telemetry plugin to examples

Changes

2 files changed, 43 insertions(+), 1 deletions(-)


Diff

diff --git a/docs/example_plugins/lxmd_telemetry.py b/docs/example_plugins/lxmd_telemetry.py
new file mode 100644
index 00000000..bef47b94
--- /dev/null
+++ b/docs/example_plugins/lxmd_telemetry.py
@@ -0,0 +1,41 @@
+# This is an LXMd telemetry plugin that
+# queries a running LXMF Propagation Node
+# for status and statistics.
+
+import RNS
+
+class LXMdTelemetryPlugin(SidebandTelemetryPlugin):
+ plugin_name = "lxmd_telemetry"
+
+ def start(self):
+ # Do any initialisation work here
+ RNS.log("LXMd telemetry plugin starting...")
+
+ # And finally call start on superclass
+ super().start()
+
+ def stop(self):
+ # Do any teardown work here
+ pass
+
+ # And finally call stop on superclass
+ super().stop()
+
+ def update_telemetry(self, telemeter):
+ if telemeter != None:
+ if not "lxmf_propagation" in telemeter.sensors:
+ # Create lxmd status sensor if it is not already
+ # enabled in the running telemeter instance
+ telemeter.enable("lxmf_propagation")
+
+ # Set the identity file used to communicate with
+ # the running LXMd instance.
+ telemeter.sensors["lxmf_propagation"].set_identity("~/.lxmd/identity")
+
+ # You can also get LXMF Propagation Node stats
+ # from an LXMd instance running inside nomadnet
+ # telemeter.sensors["lxmf_propagation"].set_identity("~/.nomadnetwork/storage/identity")
+
+# Finally, tell Sideband what class in this
+# file is the actual plugin class.
+plugin_class = LXMdTelemetryPlugin

diff --git a/docs/example_plugins/telemetry.py b/docs/example_plugins/telemetry.py
index c6993e9f..fc4f6180 100644
--- a/docs/example_plugins/telemetry.py
+++ b/docs/example_plugins/telemetry.py
@@ -59,7 +59,8 @@ class BasicTelemetryPlugin(SidebandTelemetryPlugin):
# Create fuel sensor
telemeter.synthesize("fuel")
- telemeter.sensors["fuel"].update_entry(capacity=75, level=61)
+ telemeter.sensors["fuel"].update_entry(capacity=75, level=61, type_label="Main")
+ telemeter.sensors["fuel"].update_entry(capacity=15, level=15, type_label="Reserve")
# Finally, tell Sideband what class in this
# file is the actual plugin class.


──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────